﻿using System;
using BusinessEntities;
using Draco.DataStructure;

namespace BusinessLayer
{
    public abstract class LocatingPointBLL<T>
        where T : ILocatingPoint
    {

        /// <summary>
        /// 得到附近的地点
        /// </summary>
        /// <param name="x">x</param>
        /// <param name="y">y</param>
        /// <param name="errorLevel">误差范围</param>
        /// <returns>地点列表</returns>
        public abstract D_LinkList<T> GetNearbySites(int x, int y, SeekAdmissibleError errorLevel);

        /// <summary>
        /// 由id得到相应的数据
        /// </summary>
        /// <param name="id">id</param>
        /// <returns>数据</returns>
        public abstract T GetSite(int id);


        /// <summary>
        /// 添加地点，更新数据库,可不带ID
        /// </summary>
        /// <param name="site">地点</param>
        public abstract void AddSite(T site);
        /// <summary>
        /// 更新地点，更新数据库,必须带ID
        /// </summary>
        /// <param name="site">地点</param>
        public abstract void UpdateSite(T site);
        /// <summary>
        /// 删除地点，更新数据库
        /// </summary>
        /// <param name="id">id</param>
        public abstract void DeleteSite(int id);

    }

    /// <summary>
    /// 范围搜索容差，级别越高容差越大
    /// </summary>
    public enum SeekAdmissibleError
    {
        Level_1,  //±5.859375m   
        Level_2,  //±11.71875m
        Level_3,  //±23.4375m 
        Level_4,  //±46.875m
        Level_5,  //±93.75m 
        Level_6,  //±187.5m
        Level_7,  //±375m
        Level_8,  //±750m
    }
}
